import axios from "../../utils/request";

function getList(query) {
    return axios.get('/list', { params: query })
}
/// 直播
function getLive(query) {
    return axios.get('/live', { params: query })
}
/// 团购管理
function getGrop(query) {
    return axios.get('/grop', { params: query })
}

function addList(body) {
    return axios.post('/addList', body)
}
/// 筛选直播列表
function switchLive(type) {
    return axios.get('/switchLive', { params: type })
}
/// 添加团购数据
function addGrop(body) {
    return axios.post('/addGrop', body)
}
// 筛选团购
function switchGrop(type) {
    return axios.get('/switchGrop', { params: type })
}

function editList(body) {
    return axios.put('/editList', body)
}
function editGrop(body) {
    return axios.put('/editGrop', body)
}

function delList(id) {
    return axios.delete(`/delList/${id}`)
}
/// 删除直播数据
function delLive(id) {
    return axios.delete(`/delLive/${id}`)
}
/// 删除团购数据
function delGrop(id) {
    return axios.delete(`/delGrop/${id}`)
}

/// 详情页数据
function detailId(id) {
    return axios.post(`/detail/${id}`)
}

function Search(query) {
    return axios.get(`/search?title=${query}`);
}

///登录
function login(body) {
    return axios.post('/login', body)
}

export default {
    getList,
    getLive,
    getGrop,
    addList,
    switchLive,
    addGrop,
    editList,
    editGrop,
    switchGrop,
    delList,
    delLive,
    delGrop,
    detailId,
    Search,
    login
}